
class LazySingleton {

    private static final Object locker = new Object();
    private static LazySingleton instance = null;

    int x = 10;
    private LazySingleton() {};

    public static LazySingleton getInstance() {
        if(instance == null) {
            synchronized (locker) {
                if (instance == null) {
                    instance = new LazySingleton();
                }
            }
        }
        return instance;
    }
}

public class Main {
    public static void main(String[] args) {
        LazySingleton ret = LazySingleton.getInstance();
        System.out.println(ret.x);
    }
}
